package com.dailyblue.example.springcloud.provider.controller;

import com.dailyblue.example.springcloud.commons.bean.User;
import com.dailyblue.example.springcloud.commons.config.JwtConfig;
import com.dailyblue.example.springcloud.commons.util.JsonResult;
import com.dailyblue.example.springcloud.commons.util.ResultTool;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    @PostMapping
    public JsonResult login(User user) {
        String token = JwtConfig.getJwtToken(user);
        return ResultTool.success(token);
    }
}
